package com.net.framework.help.utils;

import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;

/**
 * Author：xiaobin.zhang
 * Email：154722566@qq.com
 * Date：2016/9/12 9:40
 * Desc：<--WebView自适应展示-->
 */
public class WebViewAdaptiveDisplays {
    public static void webImage(WebView webView, String url) {
        webView.setVisibility(View.VISIBLE);
        WebSettings settings = webView.getSettings();
        if (android.os.Build.VERSION.SDK_INT < 19) {
            settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        } else {
            settings.setUseWideViewPort(true);
        }
        settings.setLoadWithOverviewMode(true);
        webView.getSettings().setSupportZoom(false);
        webView.getSettings().setBuiltInZoomControls(false);
        try {
            webView.loadUrl(url);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
